package org.example.ui.customer;

import org.example.model.MilkTea;
import org.example.model.Order;

import javax.swing.*;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;

public class DispositionSettleDialog extends JDialog {
    public DispositionSettleDialog(MilkTea milkTea) {
        super(new JFrame(),"",true);
        setBounds(100,10,500,700);
        setLayout(null);
        DispositionPanel dispositionPanel = new DispositionPanel(this);
        dispositionPanel.setAboutMilk(milkTea);
        add(dispositionPanel);
        addFocusListener(new FocusListener() {
            @Override
            public void focusGained(FocusEvent e) {

            }

            @Override
            public void focusLost(FocusEvent e) {
                setVisible(false);
            }
        });
    }
    public DispositionSettleDialog(Order order, int type) {
        super(new JFrame(),"",true);
        setBounds(100,10,500,700);
        setLayout(null);
        SettlementPanel settlementPanel = new SettlementPanel(this, order, type);
        add(settlementPanel);
        addFocusListener(new FocusListener() {
            @Override
            public void focusGained(FocusEvent e) {

            }

            @Override
            public void focusLost(FocusEvent e) {
                setVisible(false);
            }
        });
    }
}
